CC	:= arm-linux-gcc
LD	:= arm-linux-ld
OBJCOPY	:= arm-linux-objcopy
OBJDUMP	:= arm-linux-objdump

TOPDIR	:= `cd ..; pwd`
CFLAGS	:= -I$(TOPDIR)/include
LDFLAGS	:= -Ttext 0x00000000

OBJS	:= start.o
ELF	:= test.elf
BIN	:= test.bin
DIS	:= test.dis
DDIS	:= test.D.dis

$(BIN) : $(ELF)
	$(OBJCOPY) -O binary -S $< $@
	$(OBJDUMP) -d $< > $(DIS)
	$(OBJDUMP) -D $< > $(DDIS)

$(ELF) : $(OBJS)
	$(LD) $(LDFLAGS) -o $@ $^

%.o : %.S
	$(CC) $(CFLAGS) -c $<

%.o : $.c
	$(CC) $(CFLAGS) -c $<

clean:
	rm -vf *.o *.elf *.bin *.dis
